import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)
import Api from '../api/index'
export default new Vuex.Store({
  state: {
    token:null
  },
  getters: {
  },
  mutations: {
    from(state,token){
      state.token = token
    }
  },
  actions: {
     async login(context,Getata){

      let red = await Api.login(Getata)
      console.log(red);
      if(red.data.code=='00000'){
        context.commit('from',red.data.token)
      }
      
    }
  },
  modules: {},
});
